<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>
    // 🔔 普通函数和箭头函数中this的区别?
    // 1. 普通函数, 谁调用this指向谁.
    // 2. 箭头函数, 本身没有this, 会自动绑定执行时所处环境中的this
    const person = {
      name: "zs",
      sayHello() {
        console.log('this  ----->  ', this);
      },
      sayHi: () => {
        console.log('this  ----->  ', this);
      }
    }

    person.sayHello()  // 打印出this是谁?  person
    person.sayHi()  // 打印出this是谁? window

  </script>

</body>

</html>